<template>
	<view>
		<div >
			<uni-nav-bar  left-icon="left" title="用户信息"  :border="false"
				 @clickLeft="back" />
				 
				 
				 <uni-list style="position: relative; top: 5%; ">
				 	<uni-list-item showArrow title="头像" />
				 	<uni-list-item showArrow title="昵称" :rightText=this.loginUserName />
					<uni-list-item showArrow title="手机号" :rightText = this.phone  link="reLaunch" to="/pages/myInfo/editInfo/updatePhone" />
					<uni-list-item showArrow title="密码"  rightText="设置密码" link="reLaunch" to="/pages/myInfo/editInfo/updatePassword" />
				 </uni-list>
				 
				 <uni-list style="position:  relative; top: 60px; ">
				 	<uni-list-item showArrow title="身份认证" />
				 	<uni-list-item showArrow title="注销服务" rightText="注销后无法恢复" />
				 	<uni-list-item showArrow title="第三方账号设置" />
				 </uni-list>
				 
				 <uni-list style="position:  relative; top: 90px; height: 50px; ">
				 	<text @click="logout" style="text-align: center; position: relative;top: 12px; font-size: 17px; color: lightskyblue;"> 退出登录</text>
				 </uni-list>
		</div>
		
			 
			 
	</view>
</template>

<script>
	export default {
		data() {
			return {
				loginUserName: '',
				phone: ''
			}
		},
		onLoad(option) {
			uni.getStorage({
				key: 'userName',
				success:(res)=> {
					console.log(res.data + "登录用户:"+res.data)
					this.loginUserName = res.data
				}
			});
			uni.getStorage({
				key: 'phone',
				success:(res)=> {
					console.log(res.data + "登录用户手机号:"+res.data)
					this.phone = res.data
				}
			});
			uni.getStorage({
				key: 'isChain',
				success:(res) =>{
					console.log(res.data + "登录用户类型:"+res.data)
					this.loginUserType = res.data
				}
			});
			uni.getStorage({
				key: 'userId',
				success:(res) =>{
					console.log(res.data + "登录用户id:"+res.data)
					this.userId  = res.data
				}
			});
		},
		methods: {
			// 返回
			back(){
				uni.switchTab({
					url:'/pages/home/home'
				})
			},
			 
			// 退出登录
			 // 退出登录
			 logout(){
			 	uni.removeStorage({
			 		key: 'userId',
			 		success: function (res) {
			 			console.log('success');
			 		}
			 	});
			 	uni.removeStorage({
			 		key: 'isChain',
			 		success: function (res) {
			 			console.log('success');
			 		}
			 	});
			 
			 	uni.clearStorageSync();
			 	uni.clearStorage();
			 	uni.reLaunch({
			 		url: '/pages/login'
			 	})	
			 },
			 // 修改手机号
			 updatePhone(phone){
				 console.log("手机号："+phone)
			 }
		}
	}
</script>

<style>

</style>
